#include <iostream>
using namespace std;

class Person
{
public:
    Person()
    {
        cout << "Person()" << endl;
    }
    virtual ~Person()
    {
        cout << "~Person()" << endl;
    }

    virtual void run()
    {
        cout << "Person::run()" << endl;
    }

private:
    int m_age;

};

class Student : public Person
{
public:
    Student()
    {
        cout << "Student()" << endl;
    }
    ~Student()
    {
        cout << "~Student()" << endl;
    }

    virtual void run()
    {   
        Person::run();
        cout << "Student::run()" << endl;
    }

private:
    int m_score;

};

int main()
{
    const char* str  = "hello world";
#if 0
    /* const 转非const*/
    char * buffer = const_cast<char *>(str);
#else 0
    /* 不能用，直接报错*/
    char * buffer = dynamic_cast<char *>(str);
#else 0
    /* 非const 转const*/
    const char * buffer = static_cast<char *>(str);
#endif

    // Person * p1 = new Person();
    // Person * p2 = new Student();
    /* static_cast没有安全检查*/
    // Student * stu1 = static_cast<Student *> (p1);
    // Student * stu2 = static_cast<Student *> (p2);
    return 0;
}